package cn.sciento.core.undertow;

import io.undertow.Undertow;
import io.undertow.UndertowOptions;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.autoconfigure.web.embedded.UndertowWebServerFactoryCustomizer;
import org.springframework.boot.web.embedded.undertow.ConfigurableUndertowWebServerFactory;
import org.springframework.boot.web.embedded.undertow.UndertowBuilderCustomizer;
import org.springframework.boot.web.server.WebServerFactory;
import org.springframework.core.env.Environment;

public class CustomUndertowWebServerFactoryCustomizer extends UndertowWebServerFactoryCustomizer {
  public CustomUndertowWebServerFactoryCustomizer(Environment environment, ServerProperties serverProperties) {
    super(environment, serverProperties);
  }
  
  public void customize(ConfigurableUndertowWebServerFactory factory) {
    super.customize(factory);
    factory.addBuilderCustomizers(builder -> builder.setServerOption(UndertowOptions.ALLOW_UNESCAPED_CHARACTERS_IN_URL, Boolean.valueOf(true)));
  }
}
